﻿using AutoMapper;
using Tauren.Form.Entity.Const;

namespace Tauren.Form.Mapper
{
    public class Form_TableInfoProfile : Profile, ICommProfile
    {
        public Form_TableInfoProfile()
        {
            InitProfile();
        } 

        public void InitProfile()
        {
            CreateMap<Entity.Model.Form_TableInfo, Entity.Output.Form_TableInfo_OutPut>().AfterMap((data, viw) =>
            {
                viw.Dic_Creatdate = data.Creatdate is null ? "" : data.Creatdate.Value.ToString(GlobalConst.DATE_FORMAT_SECONDS);
                viw.Dic_Modifdate = data.Modifdate is null ? "" : data.Modifdate.Value.ToString(GlobalConst.DATE_FORMAT_SECONDS);
            });
            CreateMap<Entity.Input.Form_TableInfo_InPut, Entity.Model.Form_TableInfo>();
            CreateMap<Entity.Model.Form_Child_TableInfo, Entity.Output.Form_Child_TableInfo_OutPut>();
            CreateMap<Entity.Input.Form_Child_TableInfo_InPut, Entity.Model.Form_Child_TableInfo>();
            CreateMap<Entity.Model.Form_SametableInfo, Entity.Output.Form_SametableInfo_OutPut>();
            CreateMap<Entity.Input.Form_SametableInfo_InPut, Entity.Model.Form_SametableInfo>();
        }
    }
}
